<HTML><HEAD>
<!--
    ---------------------
    Window Remote Creator
    ---------------------
-->

<SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers

/*
    THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com
    Copyright (c)1998 by Charles River Media.  All Rights Reserved.
    
    This applet can only be re-used or modifed by license holders of the
    JavaScript Cookbook CD-ROM.  Credit must be given in the source
    code and this copyright notice must be maintained. If you do
    not hold a license to the JavaScript Cookbook, you may NOT
    duplicate or modify this code for your own use.

    Use at your own risk. No warranty is given or implied of the suitability 
    of this applet for any specific application. Neither Erica Sadun nor 
    Charles River Media will be held responsible for any unwanted effects 
    due to the use of this applet or any derivative. 
*/

// Create and pop up a small window
//var isNN = false;
//var appName = navigator.appName;

//isNN = (appName == "Netscape")

function PopIt()
{
  popup = window.open("CONTROL1.HTM","popDialog",
      "height=60,width=156,scrollbars=no")
      
  // repeat for Macs
  popup = window.open("CONTROL1.HTM","popDialog",
      "height=60,width=156,scrollbars=no")
      
  // set pointer back to this window
//  if(!isNN)
//  	popup.mainWindow = top;
}
<!-- done hiding --></SCRIPT></HEAD>

<BODY bgcolor="ffffff" link="0000ff" vlink="770077">
    
<FONT COLOR="007777"><H1><IMG SRC="../GRAFX/SPICE.JPG" WIDTH=37 HEIGHT=72
ALIGN = LEFT>Window Remote Control</H1></FONT>
<BLOCKQUOTE><FONT SIZE=4>
    This script creates a small remote control that lets you move
    backwards and forwards through your history, or reload the
    current page for this window.<p>
    <FORM><INPUT TYPE="BUTTON" VALUE="Start Remote" onClick="PopIt()">
    </FORM>
</FONT></BLOCKQUOTE>


<br><br>
<FONT COLOR="007777"><H2>Discussion</H2></FONT>
<FONT SIZE=4>
The remote control is created as a separate window; the <FONT COLOR="007777">opener</FONT> property of the
new window points back to this window. The remote needs this in order to access this page's
history. If no parent window is found, the remote will first attempt to
back up and otherwise will close itself.<P>
<p>
</FONT>

<FONT COLOR="770000"><PRE>
// Create and pop up a small window
function PopIt()
{
  popup = window.open("CONTROL1.HTM","popDialog",
      "height=60,width=156,scrollbars=no")
      
  // repeat for Macs
  popup = window.open("CONTROL1.HTM","popDialog",
      "height=60,width=156,scrollbars=no")

  // popup.opener points back to this window   
}
</PRE></FONT>

<h3>The new remote must point to a main window</h3>
<FONT COLOR="770000"><PRE>
if (self.opener == null) 
{
    if (self.history.length > 1)
    {
        alert('There is no main window associated with this remote. '+
              'The remote control will now back up to the previous window.')
        self.history.go(-1)
    }
    else
    {
        alert('This remote control has no main window.  '+
            'This remote will now close.')
        self.close()
    }
}
</PRE></FONT>
<h5>Copyright ©1998 by Charles River Media, All Rights Reserved</h5>
</BODY>
</HTML>